Skip to content

Add synchronous load_with constructors and run escape hatch to wrapped_async#864

Open
suri-kumkaran wants to merge 4 commits intomainfrom
users/suryangupta/load-feature-in-wrapped-async
Open

Add synchronous load_with constructors and run escape hatch to wrapped_async#864
suri-kumkaran wants to merge 4 commits intomainfrom
users/suryangupta/load-feature-in-wrapped-async

Conversation

@suri-kumkaran
Copy link
Copy Markdown
Contributor

Why

Sync callers who need to load a prebuilt index must manually create a tokio runtime and call the async LoadWith trait — leaking async internals. Similarly, there's no way to call an async method on the inner index if a sync wrapper doesn't exist for it yet.

What

All changes are in diskann-providers/src/index/wrapped_async.rs.

  • load_with_multi_thread_runtime, load_with_current_thread_runtime, load_with_handle — Sync constructors that load a prebuilt index from storage, mirroring the existing new_with_* pattern.
  • run — Escape hatch: runs any async closure against the inner index on the wrapper's runtime, for methods that don't have a dedicated sync wrapper.
  • Extracted create_multi_thread_runtime / create_current_thread_runtime helpers to reduce duplication.
  • test_save_then_sync_load_round_trip — End-to-end test: build → insert → save (via run) → load → search.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds synchronous entry points to load prebuilt async DiskANN indexes in diskann-providers, and introduces a run escape hatch for calling async-only inner methods from the sync wrapper.

Changes:

  • Added load_with_multi_thread_runtime, load_with_current_thread_runtime, and load_with_handle sync constructors that wrap LoadWith::load_with.
  • Added run to execute an arbitrary async closure on the wrapper’s runtime/handle.
  • Added an end-to-end save→sync-load→search round-trip test and refactored runtime creation into helpers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 72.65625% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.27%. Comparing base (b616aa3) to head (1ec1a14).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
diskann-providers/src/index/wrapped_async.rs 72.65% 35 Missing ⚠️

❌ Your patch status has failed because the patch coverage (72.65%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #864      +/-   ##
==========================================
- Coverage   90.45%   89.27%   -1.18%     
==========================================
  Files         442      442              
  Lines       83248    83368     +120     
==========================================
- Hits        75301    74430     -871     
- Misses       7947     8938     +991     
Flag Coverage Δ
miri 89.27% <72.65%> (-1.18%) ⬇️
unittests 89.11% <72.65%> (-1.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
diskann-providers/src/index/wrapped_async.rs 46.99% <72.65%> (+14.24%) ⬆️

... and 38 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants